package main

import (
	"fmt"
	"log"

	"github.com/garyburd/redigo/redis"
)

func main() {
	con, err := redis.Dial("tcp", "1.15.136.124:6379", redis.DialPassword("liu15332"))
	if err != nil {
		log.Panic("open redis error!")
	}
	defer con.Close()
	_, err = con.Do("Set", "key1", 998)
	if err != nil {
		log.Println(err)
		log.Panic("do error!")
	}
	r, err := redis.Int(con.Do("get", "key1"))
	//r本质是一个空接口 所以需要转换
	if err != nil {
		log.Panic("int error!")
	}
	fmt.Println(r)
}
